import axios from 'axios'
import Nprogress from 'nprogress'
import 'nprogress/nprogress.css'
const Service = axios.create({
  baseURL: '/mock',
  timeout: 20000
})
Service.interceptors.request.use(function (config) {
  Nprogress.start()
  return config;
})
// }, function (error) {
//   return Promise.reject(error);
// });
Service.interceptors.response.use(function (response) {
  Nprogress.done()
  return response.data;
}, function (error) {
  Nprogress.done()
  alert('请求失败','错误信息:' +error.message)
  return Promise.reject(error);
});
export default Service